package com.fuzhenguo.boltmusic;

import android.app.Activity;
import android.app.ListActivity;
import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore.Audio.Media;
import android.widget.ListAdapter;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;

public class Bolt_MusicActivity extends Activity {
    private ContentResolver mContentResolver;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mContentResolver = this.getContentResolver();
        Uri uri = Media.EXTERNAL_CONTENT_URI;
        Cursor cursor = mContentResolver.query(uri, null, null, null, null);
        startManagingCursor(cursor);
        String[] columnNames = cursor.getColumnNames();
        int[] columnIds = new int[columnNames.length];
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < columnNames.length; i++) {
            sb.append(columnNames[i] + "\t\t");
            columnIds[i] = cursor.getColumnIndex(columnNames[i]);
        }
        sb.append("\n");
        TextView tv = (TextView) findViewById(R.id.full_content);

//        ListAdapter adapter = new SimpleCursorAdapter(this, layout, cursor, from, to);
//        sb.delete(0, sb.length() - 1);
//        if( cursor != null && cursor.moveToFirst()) {
//            do {
//                for(int i = 0; i < columnIds.length; i++) {
//                    sb.append(cursor.getString(columnIds[i]) + "\t\t");
//                }
//                sb.append("\n");
//            } while (cursor.moveToNext());
//        }
        
        tv.setText(sb);
        
    }
}